package com.feihong.txgw.utils.glidehttps;

import com.bumptech.glide.request.RequestOptions;
import com.feihong.txgw.R;

/**
 * @Author wangziheng
 * @ProjectName txgw_app
 * @ClassName GlideOptionsSetting
 * @package com.feihong.txgw.utils.glidehttps
 * @data 2018/5/31 16:11
 * @Describe
 * @Change
 */
public class GlideOptionsSetting {

    public static RequestOptions getDefaultOptions(int errorImg,int placeImg){
        RequestOptions requestOptions = new RequestOptions();
        if(errorImg == 0 && placeImg == 0){
            throw new NullPointerException("errorImg  &  placeImg  不能同时为空" );
        }
        if(errorImg == 0){
            return requestOptions.placeholder(placeImg);
        }else if(placeImg == 0){
            return requestOptions.error(errorImg);
        }
        return new RequestOptions()
                .error(errorImg)
                .placeholder(placeImg);
    }
}
